//封装所有和用户相关的接口函数
import request from "@/utils/http";


// 根据地址id查询地址
export function findAddressByIdAPI(addressId) {
    return request({
        url: `/addresses/${addressId}`,
        method: 'get'
    });
}

// 查询当前用户地址列表
export function findMyAddressesAPI() {
    return request({
        url: '/addresses',
        method: 'get'
    });
}



// 新增订单地址
export function saveDeliveryAddressAPI(address) {
    return request({
        url: '/addresses',
        method: 'post',
        data: address
    });
}

// 修改地址
export function updateDeliveryAddressAPI(address) {
    return request({
        url: '/addresses',
        method: 'put',
        data: address
    });
}

// 删除地址
export function removeDeliveryAddressAPI(daId) {
    return request({
        url: `/addresses/${daId}`,
        method: 'delete'
    });
}
